#ifndef SESSION_H
#define SESSION_H
#include <pthread.h>
#define CACHE_NUM 1024
#define MAX_ACCOUNT_LEN 128
typedef struct session {
	char sess_id[16];
	char account[MAX_ACCOUNT_LEN];
	unsigned int auth;
	char addr[16];
	int bus_fd; //业务描述符
	int chat_fd; //实时对话描述符
	unsigned enable;
	time_t t_stamp;
	struct session *next, *prev;
}se_session_st;

typedef struct sess_head {
	se_session_st session_head;
	int sess_num;
	se_session_st *cache[CACHE_NUM];
	se_session_st **cache_pos;
	pthread_rwlock_t rw_lock;
}se_head_st;

void sess_init(void)__attribute__((constructor));
void sess_fini(void)__attribute__((destructor));

#endif
